package com.ljf.interestingmaps;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;

import com.ljf.interestingmaps.maps.AboutActivity;
import com.ljf.interestingmaps.maps.MapFragment;
import com.ljf.interestingmaps.maps.MapsActivity;
import com.ljf.interestingmaps.nearby.NearActivity;
import com.ljf.interestingmaps.routefinder.RouteActivity;
import com.ljf.interestingmaps.streetview.MapandStreetView;
import com.ljf.interestingmaps.streetview.StreetViewActivity;

public class MainActivity extends AppCompatActivity {

    private MapFragment mapFragment;
    private AboutActivity aboutActivity;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    public void onDirectionClick(View view) {
        switch (view.getId())
        {
            case R.id.maps:
                startActivity(new Intent(MainActivity.this, MapsActivity.class));
                break;
            case R.id.streetview:
                startActivity(new Intent(MainActivity.this, StreetViewActivity.class));
                break;
            case R.id.mapstreetview:
                startActivity(new Intent(MainActivity.this, MapandStreetView.class));
                break;
            case R.id.nearby:
                startActivity(new Intent(MainActivity.this, NearActivity.class));
                break;
            case R.id.route:
                startActivity(new Intent(MainActivity.this, RouteActivity.class));
                break;
        }
    }

    @SuppressLint("HandlerLeak")
    Handler mapHandler = new Handler(){
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            getCurrentLocation(msg);
        }
    };

    private void getCurrentLocation(Message msg){
        System.out.println("-----------getCurrentLocation------------");
    }

    @Override
    public void onBackPressed() {
        Intent intent = new Intent();
        intent.setAction(Intent.ACTION_MAIN);
        intent.addCategory(Intent.CATEGORY_HOME);
        startActivity(intent);
    }
}
